package net.malkuth.test;

import android.content.Intent;
import android.graphics.Bitmap;
import android.view.KeyEvent;
import android.view.View;
import android.widget.Button;

/**
 * Created by 一些年华 on 2016/7/18.
 */
public class ConnectLoginActivity extends BaseNewActivity implements View.OnClickListener {
    private static final String DECODED_CONTENT_KEY = "codedContent";
    private static final String DECODED_BITMAP_KEY = "codedBitmap";
    private String content;
    private Bitmap bitmap;
    private Button mClose, mLogin, mDismis;

    @Override
    public void setupView() {
        mClose = (Button) findViewById(R.id.btn_close);
        mLogin = (Button) findViewById(R.id.button2);
        mDismis = (Button) findViewById(R.id.button3);
        mClose.setOnClickListener(this);
        mLogin.setOnClickListener(this);
        mDismis.setOnClickListener(this);
    }

    @Override
    public void setContent() {
        setContentView(R.layout.activity_connectlogin);
    }

    @Override
    public void setModel() {

    }

    @Override
    public boolean getIntentValue() {
        content = getIntent().getStringExtra(DECODED_CONTENT_KEY);
        bitmap = getIntent().getParcelableExtra(DECODED_BITMAP_KEY);
        return true;
    }

    @Override
    public boolean onKeyDown(int keyCode, KeyEvent event) {
        if (keyCode == KeyEvent.KEYCODE_BACK && event.getRepeatCount() == 0) { //按下的如果是BACK，同时没有重复
            //            Toast.makeText(ml78.this,"返回键Back键测试",1).show();
            this.overridePendingTransition(R.anim.activity_close, 0);
            finish();
            return true;
        }

        return super.onKeyDown(keyCode, event);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.btn_close:
                this.overridePendingTransition(R.anim.activity_close, 0);
                finish();
                break;
            case R.id.button2:
                startActivity(new Intent(ConnectLoginActivity.this, MainActivity.class));
                break;
            case R.id.button3:
                this.finish();
                break;
        }
    }
}
